import java.util.HashMap;

import Messages.MonitorDataTypeEnum;

class ThreadManager {
	HashMap <String, MThread> ThreadMap = new HashMap<String, MThread>();
	public void Start(String monitorIP, int monitorPort,
			MonitorDataTypeEnum monitorDataType, Object[] parameters) {
		
		MThread t = new MThread(monitorIP, monitorPort,	monitorDataType, parameters);
		
		/* Store new thread into the hashmap */ 
		ThreadMap.put(monitorIP + monitorDataType.name(), t);
		
		/* Go! */
		new Thread(t).start();
	}
	
	public void Stop(String monitorIP, MonitorDataTypeEnum monitorDataType) {
		
		MThread y = ThreadMap.get(monitorIP + monitorDataType.name());
		
		/* Stop thread if exist */
		if (y != null)
			y.shutdown();
	}
	
}
